package mundo;

public class Event implements Comparable<Event> {
	
	public static final int CLIENT_ARRIVES = 1;
	public static final int SERVICE_FINISHED = 2;
	private int tipo;
	private Servidor servidor; // only for SERVICE_FINISHED
	private double tiempo; // time of the event
	
	// create CLIENT_ARRIVES event
	  public Event(double t)
	  {
	    tipo = CLIENT_ARRIVES;
	    tiempo = t;
	  }

	  // create SERVICE_FINISHED event
	  public Event(double t, Servidor s)
	  {
	    tipo = SERVICE_FINISHED;
	    tiempo = t;
	    servidor = s;
	  }
	
	public double darTiempo() { 
		return tiempo; 
	}
	
	public Servidor darServidor() {
		return servidor; 
	}
	
	public int darTipo() {
		return tipo; 
	}
	
	public int compareTo(Event rhs) {
		return (int) Math.signum(tiempo - rhs.tiempo);
	}
}